package cn.zhyjohn.paysystem.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

/**
 * Setting Swagger Class
 * @author JOHN
 * @date 2019-4-16
 */
@Configuration
@EnableSwagger2WebMvc
public class SwaggerConfig {

    @Bean
    public Docket managerApi() {
        Docket docket=new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("支付系统接口文档")
                        .description("")
                        .termsOfServiceUrl("http://www.baidu.com/")
                        .contact("18679691390@163.com")
                        .version("1.0")
                        .build())
                //分组名称
                .groupName("支付系统")
                .select()
                //这里指定Controller扫描包路径
                .apis(RequestHandlerSelectors.basePackage("cn.zhyjohn.paysystem.action"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }

}